home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
cpphtp2
/
code.jar
/
code
/
ch11
/
fig11_16.txt
< prev
next >
Wrap
Text File
|
1998-02-27
|
539b
|
22 lines
1 // Fig. 11.16: fig11_16.cpp
2 // Using hex, oct, dec and setbase stream manipulators.
3 #include <iostream.h>
4 #include <iomanip.h>
5
6 int main()
7 {
8 int n;
9
10 cout << "Enter a decimal number: ";
11 cin >> n;
12
13 cout << n << " in hexadecimal is: "
14 << hex << n << '\n'
15 << dec << n << " in octal is: "
16 << oct << n << '\n'
17 << setbase( 10 ) << n << " in decimal is: "
18 << n << endl;
19
20 return 0;
21 }